package com.xiashitech.interfaces.grpc;

import static io.grpc.MethodDescriptor.generateFullMethodName;

/**
 * <pre>
 * 服务接口.定义请求参数和相应结果
 * </pre>
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.58.0)",
    comments = "Source: agent.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class RPCUserServiceGrpc {

  private RPCUserServiceGrpc() {}

  public static final java.lang.String SERVICE_NAME = "com.xiashitech.interfaces.grpc.RPCUserService";

  // Static method descriptors that strictly reflect the proto.
  private static volatile io.grpc.MethodDescriptor<com.xiashitech.interfaces.grpc.RPCUserInfoRequest,
      com.xiashitech.interfaces.grpc.RPCUserInfoResponse> getBiStreamUserInfoMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "biStreamUserInfo",
      requestType = com.xiashitech.interfaces.grpc.RPCUserInfoRequest.class,
      responseType = com.xiashitech.interfaces.grpc.RPCUserInfoResponse.class,
      methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
  public static io.grpc.MethodDescriptor<com.xiashitech.interfaces.grpc.RPCUserInfoRequest,
      com.xiashitech.interfaces.grpc.RPCUserInfoResponse> getBiStreamUserInfoMethod() {
    io.grpc.MethodDescriptor<com.xiashitech.interfaces.grpc.RPCUserInfoRequest, com.xiashitech.interfaces.grpc.RPCUserInfoResponse> getBiStreamUserInfoMethod;
    if ((getBiStreamUserInfoMethod = RPCUserServiceGrpc.getBiStreamUserInfoMethod) == null) {
      synchronized (RPCUserServiceGrpc.class) {
        if ((getBiStreamUserInfoMethod = RPCUserServiceGrpc.getBiStreamUserInfoMethod) == null) {
          RPCUserServiceGrpc.getBiStreamUserInfoMethod = getBiStreamUserInfoMethod =
              io.grpc.MethodDescriptor.<com.xiashitech.interfaces.grpc.RPCUserInfoRequest, com.xiashitech.interfaces.grpc.RPCUserInfoResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "biStreamUserInfo"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.xiashitech.interfaces.grpc.RPCUserInfoRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.xiashitech.interfaces.grpc.RPCUserInfoResponse.getDefaultInstance()))
              .setSchemaDescriptor(new RPCUserServiceMethodDescriptorSupplier("biStreamUserInfo"))
              .build();
        }
      }
    }
    return getBiStreamUserInfoMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static RPCUserServiceStub newStub(io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<RPCUserServiceStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<RPCUserServiceStub>() {
        @java.lang.Override
        public RPCUserServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new RPCUserServiceStub(channel, callOptions);
        }
      };
    return RPCUserServiceStub.newStub(factory, channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static RPCUserServiceBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<RPCUserServiceBlockingStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<RPCUserServiceBlockingStub>() {
        @java.lang.Override
        public RPCUserServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new RPCUserServiceBlockingStub(channel, callOptions);
        }
      };
    return RPCUserServiceBlockingStub.newStub(factory, channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static RPCUserServiceFutureStub newFutureStub(
      io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<RPCUserServiceFutureStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<RPCUserServiceFutureStub>() {
        @java.lang.Override
        public RPCUserServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new RPCUserServiceFutureStub(channel, callOptions);
        }
      };
    return RPCUserServiceFutureStub.newStub(factory, channel);
  }

  /**
   * <pre>
   * 服务接口.定义请求参数和相应结果
   * </pre>
   */
  public interface AsyncService {

    /**
     * <pre>
     * agent 缓存用户信息，需要服务端推送，目前好像没用
     * </pre>
     */
    default io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCUserInfoRequest> biStreamUserInfo(
        io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCUserInfoResponse> responseObserver) {
      return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getBiStreamUserInfoMethod(), responseObserver);
    }
  }

  /**
   * Base class for the server implementation of the service RPCUserService.
   * <pre>
   * 服务接口.定义请求参数和相应结果
   * </pre>
   */
  public static abstract class RPCUserServiceImplBase
      implements io.grpc.BindableService, AsyncService {

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return RPCUserServiceGrpc.bindService(this);
    }
  }

  /**
   * A stub to allow clients to do asynchronous rpc calls to service RPCUserService.
   * <pre>
   * 服务接口.定义请求参数和相应结果
   * </pre>
   */
  public static final class RPCUserServiceStub
      extends io.grpc.stub.AbstractAsyncStub<RPCUserServiceStub> {
    private RPCUserServiceStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected RPCUserServiceStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new RPCUserServiceStub(channel, callOptions);
    }

    /**
     * <pre>
     * agent 缓存用户信息，需要服务端推送，目前好像没用
     * </pre>
     */
    public io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCUserInfoRequest> biStreamUserInfo(
        io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCUserInfoResponse> responseObserver) {
      return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
          getChannel().newCall(getBiStreamUserInfoMethod(), getCallOptions()), responseObserver);
    }
  }

  /**
   * A stub to allow clients to do synchronous rpc calls to service RPCUserService.
   * <pre>
   * 服务接口.定义请求参数和相应结果
   * </pre>
   */
  public static final class RPCUserServiceBlockingStub
      extends io.grpc.stub.AbstractBlockingStub<RPCUserServiceBlockingStub> {
    private RPCUserServiceBlockingStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected RPCUserServiceBlockingStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new RPCUserServiceBlockingStub(channel, callOptions);
    }
  }

  /**
   * A stub to allow clients to do ListenableFuture-style rpc calls to service RPCUserService.
   * <pre>
   * 服务接口.定义请求参数和相应结果
   * </pre>
   */
  public static final class RPCUserServiceFutureStub
      extends io.grpc.stub.AbstractFutureStub<RPCUserServiceFutureStub> {
    private RPCUserServiceFutureStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected RPCUserServiceFutureStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new RPCUserServiceFutureStub(channel, callOptions);
    }
  }

  private static final int METHODID_BI_STREAM_USER_INFO = 0;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final AsyncService serviceImpl;
    private final int methodId;

    MethodHandlers(AsyncService serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_BI_STREAM_USER_INFO:
          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.biStreamUserInfo(
              (io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCUserInfoResponse>) responseObserver);
        default:
          throw new AssertionError();
      }
    }
  }

  public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
    return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
        .addMethod(
          getBiStreamUserInfoMethod(),
          io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
            new MethodHandlers<
              com.xiashitech.interfaces.grpc.RPCUserInfoRequest,
              com.xiashitech.interfaces.grpc.RPCUserInfoResponse>(
                service, METHODID_BI_STREAM_USER_INFO)))
        .build();
  }

  private static abstract class RPCUserServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    RPCUserServiceBaseDescriptorSupplier() {}

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.xiashitech.interfaces.grpc.RPCAgentServiceApi.getDescriptor();
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("RPCUserService");
    }
  }

  private static final class RPCUserServiceFileDescriptorSupplier
      extends RPCUserServiceBaseDescriptorSupplier {
    RPCUserServiceFileDescriptorSupplier() {}
  }

  private static final class RPCUserServiceMethodDescriptorSupplier
      extends RPCUserServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final java.lang.String methodName;

    RPCUserServiceMethodDescriptorSupplier(java.lang.String methodName) {
      this.methodName = methodName;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (RPCUserServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new RPCUserServiceFileDescriptorSupplier())
              .addMethod(getBiStreamUserInfoMethod())
              .build();
        }
      }
    }
    return result;
  }
}
